//
//  CHSViewController.m
//  ZXUIImageUtil
//
//  Created by simon on 11/21/2022.
//  Copyright (c) 2022 simon. All rights reserved.
//

#import "CHSViewController.h"
#import <ZXUIImageUtils/ZXUIImageUtils.h>

@interface CHSViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) NSArray *titleArray;

@end

@implementation CHSViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.titleArray = @[@"垂直渐变图",@"水平渐变图"];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    
    cell.textLabel.text = [self.titleArray objectAtIndex:indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.row == 0) {
        [self gradientImage];
    }
    if (indexPath.row == 1) {
        [self gradientImage1];
    }
}


- (void)gradientImage{
//    UIImage *image = [UIImage zx_gradientVerticalDoubleColorImageWithSize:CGSizeMake(100, 30) topColor:[UIColor redColor] bottomColor:[UIColor greenColor]];
//    self.imageView.image = image;
    UIImage *image = [UIImage caiImageOfDashLineWithStrokeColor:[UIColor grayColor] lineWidth:@0.5 patternDash:8 patternGap:4 boundsSize:CGSizeMake(10, 100) lineDirectionHorizonal:NO];
    self.imageView.image = image;
}

- (void)gradientImage1{
//    UIImage *image = [UIImage zx_gradientHorizontalDoubleColorImageWithSize:CGSizeMake(100, 30) startColor:[UIColor redColor] endColor:[UIColor greenColor]];
    UIImage *image = [UIImage zx_imageWithColor:[UIColor redColor] andSize:CGSizeMake(100, 30)];
    self.imageView.image = image;
}

@end
